<template>
    <div class="modal fade" id="addFollowModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          	<div class="modal-header">
            	<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            	<h4 class="modal-title" id="myModalLabel">跟进</h4>
          	</div>
          	<div class="modal-body">
          	 	<div class="form-horizontal">
	                <div class="form-group">
	                  	<label for="" class="col-sm-4 control-label">跟进内容<label style="color: red;">*</label>：</label>
	                  	<div class="col-sm-8">
	                    	<textarea rows="5" class="form-control" v-model="follow.remark" placeholder="请填写跟进内容"></textarea>
	                  	</div>
	                </div>
					<div class="form-group">
	                  	<label for="" class="col-sm-4 control-label">&nbsp;</label>
	                  	<div class="col-sm-8 sendmsg-div">
	                    	<input type="checkbox" name="sendFollowMsg" id="sendFollowMsg" v-model="follow.sendFollowMsg">
							<font>同步发送跟进消息提醒至审核人员</font>
	                  	</div>
	                </div>
	              </div>
          		</div>
          	<div class="modal-footer">
            	<!--<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>-->
            	<button type="button" class="btn checkedBtn" v-show="btnShow" @click="saveReport">确定</button>
          	</div>
        </div>
      </div>
    </div>
</template>

<script>
	export default{
		//接收父组件的绑定值
		props: ["followModal"],
		data() {
			return {
				//机构信息对象
				follow: {
					remark: '',
					sendFollowMsg: true
				},
				btnShow: true
			}
		},
		watch: {
		},
		methods: {
			saveReport() {
				var _self = this;
				if(_self.follow.remark == ""){
					layer.msg("请填写跟进内容");
					return false;
				}
				_self.btnShow = false;
				var reqData={
					customerPremisesId: this.followModal.cusPremisesId,
					remark: _self.follow.remark,
					sendFollowMsg: _self.follow.sendFollowMsg
				}
				var body = {};
				body.params = reqData;
				var url = this.utilHelper.apiUrl+'/api/addFollow';
				_self.$http.post(url,body).then((response)=>{
					var body = response.body.resData ;
					if(body.result=="1"){
						layer.msg("操作成功!", {
								time: 1000
						}, function(){
							//关闭弹出层
							$('#addFollowModal').modal('hide');
							//子组件向父组件传递信号: 调用父组件中对子组件的监听
							_self.$emit('saveFollowListener');
						}); 				
					}else{
						layer.alert("填写跟进失败,请重新尝试!");
					}
                    _self.btnShow = true;
				},(response)=>{
					layer.alert("请求异常!");
                    _self.btnShow = true;
				});
			}
		}
	}
	
</script>
<style>
.sendmsg-div{
	padding: 0 12px;
	height: 40px;
	line-height: 40px;
}
.sendmsg-div input{
	-webkit-appearance: checkbox;
	width: 20px;
	height: 20px;
	vertical-align: top;
	margin-top: 10px;
}
.sendmsg-div font{
	font-weight: bold;
	font-size: 14px;
}
</style>
